package com.steam.util;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
public class CommonUtils {
	public final static String url = "http://ohsw0r3ox.bkt.clouddn.com/";
	public static <T> List<T> fromJsonArray(String json, Class<T> clazz)   {
		Gson gson = new GsonBuilder()
			    .setPrettyPrinting()
			    .disableHtmlEscaping()
			    .create();
		List<T> lst = new ArrayList<T>();
		JsonArray array = new JsonParser().parse(json).getAsJsonArray();
		for (final JsonElement elem : array) {
			lst.add(gson.fromJson(elem, clazz));
		}
		return lst;
	}
}
